package com.up4years.dataapi.controller;

import javax.servlet.http.HttpServletRequest;

import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.up4years.controller.base.BaseController;
import com.up4years.dataapi.service.support.CDNService;
@Scope("prototype")
@Controller
@RequestMapping("/cdn")
public class CDNController extends BaseController {

 
	@RequestMapping("/getQiniuToken.htm")
	@ResponseBody
	public String getQiniuToken(Model model, HttpServletRequest request){
		JSONObject json = new JSONObject();
		try {
			json.put("uptoken", CDNService.getUpToken());
		} catch (JSONException e) {
 			e.printStackTrace();
		}
 		return json.toString();
	}

}
